#main方法
from moto_vehicle import *
def choose_car():
    brand_index = input("请选择你要租赁的汽车品牌：1、别克 2、宝马")
    brand_map={"1":"别克","2":"宝马"}
    type_map={"别克": {"1":"林荫大道","2":"GL8"},"宝马":{"1":"X6","2":"550i"}}
    brand_name=brand_map[brand_index]
    # print(brand_name)
    type_choose=""
    for key,value in type_map[brand_name].items():
        type_choose +=key+","+value+""
    type = input("请选择你要租赁的汽车类型"+type_choose)
    type_name=type_map[brand_name][type]
    for car in cars:
        if car.brand == brand_name and car.type == type_name:
            print("品牌：",car.brand)
            print("类型：",car.type)
            print("车牌：",car.vehicle)
            print("日租金：",car.per_rent)
            rizu = car
            break
    day = input("请输入你所要租用的天数：")
    zhekou=rizu.cal_rent(int(day))
    pice=zhekou*int(day)*rizu.per_rent
    print("租金："+str(pice))
def choose_bus():
    brand_index = input("请选择你要租赁的汽车品牌：1、金龙 2、金杯")
    brand_map={"1":"金龙","2":"金杯"}
    type_map={"1":"16座","2":"34座"}
    type_index=input("输入想要的座位：1，16座 2，34座")
    # print("品牌：",brand_map[brand_index])
    # print("座位：",type_map[type_index])
    for bus in cars:
        if bus.brand==brand_map[brand_index] and bus.seat_count==type_map[type_index]:
            print("品牌：",bus.brand)
            print("类型：",bus.seat_count)
            print("车牌：",bus.vehicle)
            print("日租金：",bus.per_rent)
            rizu = bus
            break
    day = input("请输入你所要租用的天数：")
    zhekou=rizu.cal_rent(int(day))
    pice=zhekou*int(day)*rizu.per_rent
    print("租金："+str(pice))
print("***********欢迎光临腾飞汽车租赁公司***********")
answer = "n"
while answer == "n":
    print("1、轿车 	2、客车")
    keytype = input("请选择你要租赁的汽车类型：")
    cars=all_car[keytype]
    if keytype=="1":
        choose_car()
    else:
        choose_bus()
    answer=input("是否退出y/n")